﻿/*
 * OperationWrapper
 * 
 * Author: snowdreamist
 * Date: 2011/11/24
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using BitTorrentSharp.Helpers;
using BitTorrentSharp.KRPC.Messages;

namespace BitTorrentSharp.KRPC.Contract
{
    public class OperationContractWrapper
    {
        internal OperationContractWrapper(MethodInfo method, KRPCOperationContractAttribute optAttr)
        {
            if (method == null)
                throw new ArgumentNullException("method");
            if (optAttr == null)
                throw new ArgumentNullException("optAttr");
            this.Method = method;
            // operation contract
            this.MethodName = optAttr.MethodName;
            this.MethodType = optAttr.Type;
            this.IsOneWay = optAttr.IsOneWay;
        }
        /// <summary>
        /// Method info
        /// </summary>
        internal MethodInfo Method { get; private set; }
        /// <summary>
        /// Method type
        /// </summary>
        public MethodType MethodType { get; private set; }
        /// <summary>
        /// Method name
        /// </summary>
        public string MethodName { get; private set; }
        /// <summary>
        /// Is one way
        /// </summary>
        public bool IsOneWay { get; private set; }
    }
}
